\(\int \frac {\tan ^2(d (a+b \log (c x^n)))}{x} \, dx\) [169]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [F(-1)]
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 19, antiderivative size = 29 \[ \int \frac {\tan ^2\left (d \left (a+b \log \left (c x^n\right )\right )\right )}{x} \, dx=-\log (x)+\frac {\tan \left (a d+b d \log \left (c x^n\right )\right )}{b d n} \]

[Out]

-ln(x)+tan(a*d+b*d*ln(c*x^n))/b/d/n

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 29, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.105, Rules used = {3554, 8} \[ \int \frac {\tan ^2\left (d \left (a+b \log \left (c x^n\right )\right )\right )}{x} \, dx=\frac {\tan \left (a d+b d \log \left (c x^n\right )\right )}{b d n}-\log (x) \]

[In]

Int[Tan[d*(a + b*Log[c*x^n])]^2/x,x]

[Out]

-Log[x] + Tan[a*d + b*d*Log[c*x^n]]/(b*d*n)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3554

Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((b*Tan[c + d*x])^(n - 1)/(d*(n - 1))), x] - Dis
t[b^2, Int[(b*Tan[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1]

Rubi steps \begin{align*} \text {integral}& = \frac {\text {Subst}\left (\int \tan ^2(d (a+b x)) \, dx,x,\log \left (c x^n\right )\right )}{n} \\ & = \frac {\tan \left (a d+b d \log \left (c x^n\right )\right )}{b d n}-\frac {\text {Subst}\left (\int 1 \, dx,x,\log \left (c x^n\right )\right )}{n} \\ & = -\log (x)+\frac {\tan \left (a d+b d \log \left (c x^n\right )\right )}{b d n} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.09 (sec) , antiderivative size = 51, normalized size of antiderivative = 1.76 \[ \int \frac {\tan ^2\left (d \left (a+b \log \left (c x^n\right )\right )\right )}{x} \, dx=-\frac {\arctan \left (\tan \left (a d+b d \log \left (c x^n\right )\right )\right )}{b d n}+\frac {\tan \left (a d+b d \log \left (c x^n\right )\right )}{b d n} \]

[In]

Integrate[Tan[d*(a + b*Log[c*x^n])]^2/x,x]

[Out]

-(ArcTan[Tan[a*d + b*d*Log[c*x^n]]]/(b*d*n)) + Tan[a*d + b*d*Log[c*x^n]]/(b*d*n)

Maple [A] (verified)

Time = 0.18 (sec) , antiderivative size = 35, normalized size of antiderivative = 1.21

method result size
parallelrisch \(\frac {-b d \ln \left (c \,x^{n}\right )+\tan \left (d \left (a +b \ln \left (c \,x^{n}\right )\right )\right )}{b d n}\) \(35\)
derivativedivides \(\frac {\tan \left (d \left (a +b \ln \left (c \,x^{n}\right )\right )\right )-\arctan \left (\tan \left (d \left (a +b \ln \left (c \,x^{n}\right )\right )\right )\right )}{n b d}\) \(41\)
default \(\frac {\tan \left (d \left (a +b \ln \left (c \,x^{n}\right )\right )\right )-\arctan \left (\tan \left (d \left (a +b \ln \left (c \,x^{n}\right )\right )\right )\right )}{n b d}\) \(41\)
risch \(-\ln \left (x \right )+\frac {2 i}{d b n \left (\left (x^{n}\right )^{2 i b d} c^{2 i b d} {\mathrm e}^{d \left (-b \pi \,\operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}+b \pi \,\operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right ) \operatorname {csgn}\left (i c \right )+b \pi \operatorname {csgn}\left (i c \,x^{n}\right )^{3}-b \pi \operatorname {csgn}\left (i c \,x^{n}\right )^{2} \operatorname {csgn}\left (i c \right )+2 i a \right )}+1\right )}\) \(127\)

[In]

int(tan(d*(a+b*ln(c*x^n)))^2/x,x,method=_RETURNVERBOSE)

[Out]

(-b*d*ln(c*x^n)+tan(d*(a+b*ln(c*x^n))))/b/d/n

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 85 vs. \(2 (29) = 58\).

Time = 0.25 (sec) , antiderivative size = 85, normalized size of antiderivative = 2.93 \[ \int \frac {\tan ^2\left (d \left (a+b \log \left (c x^n\right )\right )\right )}{x} \, dx=-\frac {b d n \cos \left (2 \, b d n \log \left (x\right ) + 2 \, b d \log \left (c\right ) + 2 \, a d\right ) \log \left (x\right ) + b d n \log \left (x\right ) - \sin \left (2 \, b d n \log \left (x\right ) + 2 \, b d \log \left (c\right ) + 2 \, a d\right )}{b d n \cos \left (2 \, b d n \log \left (x\right ) + 2 \, b d \log \left (c\right ) + 2 \, a d\right ) + b d n} \]

[In]

integrate(tan(d*(a+b*log(c*x^n)))^2/x,x, algorithm="fricas")

[Out]

-(b*d*n*cos(2*b*d*n*log(x) + 2*b*d*log(c) + 2*a*d)*log(x) + b*d*n*log(x) - sin(2*b*d*n*log(x) + 2*b*d*log(c) +
 2*a*d))/(b*d*n*cos(2*b*d*n*log(x) + 2*b*d*log(c) + 2*a*d) + b*d*n)

Sympy [F]

\[ \int \frac {\tan ^2\left (d \left (a+b \log \left (c x^n\right )\right )\right )}{x} \, dx=\int \frac {\tan ^{2}{\left (a d + b d \log {\left (c x^{n} \right )} \right )}}{x}\, dx \]

[In]

integrate(tan(d*(a+b*ln(c*x**n)))**2/x,x)

[Out]

Integral(tan(a*d + b*d*log(c*x**n))**2/x, x)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 320 vs. \(2 (29) = 58\).

Time = 0.22 (sec) , antiderivative size = 320, normalized size of antiderivative = 11.03 \[ \int \frac {\tan ^2\left (d \left (a+b \log \left (c x^n\right )\right )\right )}{x} \, dx=-\frac {{\left (b d \cos \left (2 \, b d \log \left (c\right )\right )^{2} + b d \sin \left (2 \, b d \log \left (c\right )\right )^{2}\right )} n \cos \left (2 \, b d \log \left (x^{n}\right ) + 2 \, a d\right )^{2} \log \left (x\right ) + {\left (b d \cos \left (2 \, b d \log \left (c\right )\right )^{2} + b d \sin \left (2 \, b d \log \left (c\right )\right )^{2}\right )} n \log \left (x\right ) \sin \left (2 \, b d \log \left (x^{n}\right ) + 2 \, a d\right )^{2} + b d n \log \left (x\right ) + 2 \, {\left (b d n \cos \left (2 \, b d \log \left (c\right )\right ) \log \left (x\right ) - \sin \left (2 \, b d \log \left (c\right )\right )\right )} \cos \left (2 \, b d \log \left (x^{n}\right ) + 2 \, a d\right ) - 2 \, {\left (b d n \log \left (x\right ) \sin \left (2 \, b d \log \left (c\right )\right ) + \cos \left (2 \, b d \log \left (c\right )\right )\right )} \sin \left (2 \, b d \log \left (x^{n}\right ) + 2 \, a d\right )}{2 \, b d n \cos \left (2 \, b d \log \left (c\right )\right ) \cos \left (2 \, b d \log \left (x^{n}\right ) + 2 \, a d\right ) - 2 \, b d n \sin \left (2 \, b d \log \left (c\right )\right ) \sin \left (2 \, b d \log \left (x^{n}\right ) + 2 \, a d\right ) + {\left (b d \cos \left (2 \, b d \log \left (c\right )\right )^{2} + b d \sin \left (2 \, b d \log \left (c\right )\right )^{2}\right )} n \cos \left (2 \, b d \log \left (x^{n}\right ) + 2 \, a d\right )^{2} + {\left (b d \cos \left (2 \, b d \log \left (c\right )\right )^{2} + b d \sin \left (2 \, b d \log \left (c\right )\right )^{2}\right )} n \sin \left (2 \, b d \log \left (x^{n}\right ) + 2 \, a d\right )^{2} + b d n} \]

[In]

integrate(tan(d*(a+b*log(c*x^n)))^2/x,x, algorithm="maxima")

[Out]

-((b*d*cos(2*b*d*log(c))^2 + b*d*sin(2*b*d*log(c))^2)*n*cos(2*b*d*log(x^n) + 2*a*d)^2*log(x) + (b*d*cos(2*b*d*
log(c))^2 + b*d*sin(2*b*d*log(c))^2)*n*log(x)*sin(2*b*d*log(x^n) + 2*a*d)^2 + b*d*n*log(x) + 2*(b*d*n*cos(2*b*
d*log(c))*log(x) - sin(2*b*d*log(c)))*cos(2*b*d*log(x^n) + 2*a*d) - 2*(b*d*n*log(x)*sin(2*b*d*log(c)) + cos(2*
b*d*log(c)))*sin(2*b*d*log(x^n) + 2*a*d))/(2*b*d*n*cos(2*b*d*log(c))*cos(2*b*d*log(x^n) + 2*a*d) - 2*b*d*n*sin
(2*b*d*log(c))*sin(2*b*d*log(x^n) + 2*a*d) + (b*d*cos(2*b*d*log(c))^2 + b*d*sin(2*b*d*log(c))^2)*n*cos(2*b*d*l
og(x^n) + 2*a*d)^2 + (b*d*cos(2*b*d*log(c))^2 + b*d*sin(2*b*d*log(c))^2)*n*sin(2*b*d*log(x^n) + 2*a*d)^2 + b*d
*n)

Giac [F(-1)]

Timed out. \[ \int \frac {\tan ^2\left (d \left (a+b \log \left (c x^n\right )\right )\right )}{x} \, dx=\text {Timed out} \]

[In]

integrate(tan(d*(a+b*log(c*x^n)))^2/x,x, algorithm="giac")

[Out]

Timed out

Mupad [B] (verification not implemented)

Time = 31.48 (sec) , antiderivative size = 39, normalized size of antiderivative = 1.34 \[ \int \frac {\tan ^2\left (d \left (a+b \log \left (c x^n\right )\right )\right )}{x} \, dx=-\ln \left (x\right )+\frac {2{}\mathrm {i}}{b\,d\,n\,\left ({\mathrm {e}}^{a\,d\,2{}\mathrm {i}}\,{\left (c\,x^n\right )}^{b\,d\,2{}\mathrm {i}}+1\right )} \]

[In]

int(tan(d*(a + b*log(c*x^n)))^2/x,x)

[Out]

2i/(b*d*n*(exp(a*d*2i)*(c*x^n)^(b*d*2i) + 1)) - log(x)